package com.fengba.nanzhi.tabbar04.wz;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Toast;

import com.fengba.nanzhi.fengba.R;

import java.util.regex.Pattern;

public class ReceivaBlesActivity extends AppCompatActivity {
    private Button ReceivablesBtnNext;
    private EditText ReceivablesNumber;
    private ImageButton ReceivablesFh;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.wz_activity_receiva_bles);
        ReceivablesNumber = findViewById(R.id.ReceivablesNumber);
        ReceivablesBtnNext = findViewById(R.id.ReceivablesBtnNext);
        ReceivablesFh = findViewById(R.id.ReceivablesFh);

        //判断数字
        final  Pattern pattern = Pattern.compile("[0-9]*");
        ReceivablesBtnNext.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(!ReceivablesNumber.getText().toString().equals("")&&!ReceivablesNumber.getText().toString().equals("0")&&pattern.matcher(ReceivablesNumber.getText().toString()).matches()){
                    Intent intent = new Intent(ReceivaBlesActivity.this,PayMentActivity.class);
                    intent.putExtra("Money",ReceivablesNumber.getText().toString());
                    startActivity(intent);
                }else{
                    Toast.makeText(ReceivaBlesActivity.this, "请输入正确的金额!", Toast.LENGTH_SHORT).show();
                }
            }
        });

        ReceivablesFh.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }
}
